import { defHttp } from '/@/utils/http/axios';
import { IPostCategoryUpdateRaw } from '/@/types/system/auxiliary/category/update';
import { IGetCategoryDropdownResponse } from '/@/types/system/auxiliary/category/dropdown';
import { IGetCategoryDropdowncategoryResponse } from '/@/types/system/auxiliary/category/dropdowncategory';
import { IPostCategoryListQuery, IPostCategoryListResponse } from '/@/types/system/auxiliary/category/list';
import { IGetRawCategoryDetailsResponse } from '/@/types/system/auxiliary/category/details';
import { IPostCategoryAddRequest } from '/@/types/system/auxiliary/category/add';
import { IGetCategoryCheckNameUniqueQuery } from '/@/types/system/auxiliary/category/checkNameUnique';

/**
 * 修改商品类别
 */
export const apiPostCategoryUpdatePath = (id: string | number, params: IPostCategoryUpdateRaw) =>
  defHttp.post({ url: `/system/auxiliary/category/update/${id}`, params });
/**
 * 删除商品类别
 */
export const apiGetCategoryDeletePath = (id: string | number) => defHttp.get({ url: `/system/auxiliary/category/delete/${id}` });
/**
 * 商品类别下拉树列表,(不带带有默认分类选项)
 */
export const apiGetCategoryDropdown = () => defHttp.get<IGetCategoryDropdownResponse>({ url: `/system/auxiliary/category/dropdown` });
/**
 * 商品类别下拉树列表,(带有默认分类选项)
 */
export const apiGetCategoryDropdowncategory = () =>
  defHttp.get<IGetCategoryDropdowncategoryResponse>({ url: `/system/auxiliary/category/dropdowncategory` });
/**
 * 商品类别列表
 */
export const apiPostCategoryListQuery = (params: IPostCategoryListQuery) =>
  defHttp.post<IPostCategoryListResponse>({ url: `/system/auxiliary/category/list`, params });
/**
 * 商品类别详情
 */
export const apiGetCategoryDetailsPath = (id: string | number) =>
  defHttp.get<IGetRawCategoryDetailsResponse>({ url: `/system/auxiliary/category/details/${id}` });
/**
 * 新增商品类别
 */
export const apiPostCategoryAdd = (params: IPostCategoryAddRequest) => defHttp.post({ url: `/system/auxiliary/category/add`, params });
/**
 * 检查商品类别名称是否存在
 */
export const apiGetCategoryCheckNameUniqueQuery = (params: IGetCategoryCheckNameUniqueQuery) =>
  defHttp.get({ url: `/system/auxiliary/category/checkNameUnique`, params });
